/**
 * Copyright © 2012, 2013 dr. ir. Jeroen M. Valk
 * 
 * This file is part of ComPosiX.
 * 
 * ComPosiX is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * ComPosiX is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * ComPosiX. If not, see <http://www.gnu.org/licenses/>.
 */

function Echo(cpx, pid, fd, argv) {
	var line = argv[0];
	assert(typeof argv[0] == 'string');
	cpx.close(fd[0]);
	for ( var i = 1; i < argv.length; ++i) {
		assert(typeof argv[i] == 'string');
		line += ' ';
		line += argv[i];
	}
	line += '\n';
	cpx.put(fd[1], line);
	cpx.close(fd[1]);
	cpx.exit(pid, 0);
}
